<?php
defined('IN_TS') or die('Access Denied.');
require_once('config.php');
require_once('oauth.php');
require_once('opent.php');

$o = new MBOpenTOAuth( MB_AKEY , MB_SKEY , $_SESSION['keys']['oauth_token'] , $_SESSION['keys']['oauth_token_secret']  );
$last_key = $o->getAccessToken(  $_REQUEST['oauth_verifier'] ) ;//获取ACCESSTOKEN
//$_SESSION['last_key'] = $last_key;

//print_r($last_key);
$userid = intval($TS_USER['user']['userid']);

$qqt_oauth_token = $last_key['oauth_token'];
$qqt_oauth_token_secret = $last_key['oauth_token_secret'];

$DB->query("update ".dbprefix."app_user_info set `qqt_oauth_token`='$qqt_oauth_token',`qqt_oauth_token_secret`='$qqt_oauth_token_secret' where userid='$userid'");

$strUser	= $DB->once_fetch_assoc("select  * from ".dbprefix."app_user_info where userid='$userid'");
$_SESSION['tsuser']	= $strUser;



header("Location: index.php");

exit();